﻿#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

//main81&82：指针类型int*和char*数组
int main81()
{
	int a = 10;
	int b = 20;
	int c = 30;
	int* pArr[] = { &a,&b,&c };
	//pArr[0] = &a;
	//pArr[1] = &b;
	*pArr[0] = 100;
	printf("1.输出指针类型数组pArr的元素&a对应的a的值：%d\n", a);//100
	printf("2.输出元素b的值：%d\n", b);//20
	printf("3.输出元素c的值：%d\n", c);//30

	int arr[] = { 1,2,3 };
	int* pArrAddress[] = { arr,&b,&c };

	system("pause");
	return EXIT_SUCCESS;
}
int main82(void)
{
	//5.存储char* 类型的地址数组；arr并不是存储的字符串，而是字符串的地址；
	char* arr[] = { "hello","world1","nihao23","baolei34" };
	printf("4.输出指针类型数组arr的元素arr[0]的地址对应的值：%c\n", *arr[0]);//h
	printf("6.输出指针类型数组arr的元素arr[0]里面第二个字符地址对应的值：%c\n", *(arr[0] + 1));//e

	int len = strlen(arr[1]);//0-->1
	printf("7.输出strlen求出指针类型数组里面元素arr[0]的内存大小：%d\n", len);//5-->6
	return 0;
}